package pub.tbc.toolkit.http2;

import lombok.Getter;

/**
 * @author tbc on 2016/11/7 10:53:18.
 */
public enum HttpContentType {
    APPLICATION_JSON("application/json"),
    CONTENT_TYPE_FORM("application/x-www-form-urlencoded"),
    TEXT_PLAIN("text/plain"),
    TEXT_XML("text/xml");

    private static final String DEFAULT_CHARSET = "utf-8";


    @Getter
    private String key = "Content-Type";
    @Getter
    private String mimeType;
    @Getter
    private String charset;

    private HttpContentType(String mimeType) {
        this(mimeType, DEFAULT_CHARSET);
    }

    private HttpContentType(String mimeType, String charset) {
        this.mimeType = mimeType;
        this.charset = charset;
    }

    public String getValue() {
        return mimeType + ";" + charset;
    }

    public static String getName() {
        return "Content-Type";
    }


}
